package com.run.wz.center.utils;

import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.InvalidProtocolBufferException;
import com.run.pbf.Bcp.AntiProxy;
import com.run.pbf.Bcp.Blog;
import com.run.pbf.Bcp.CispOnlineLog;
import com.run.pbf.Bcp.Cmpp;
import com.run.pbf.Bcp.CrawlerLog;
import com.run.pbf.Bcp.Dns;
import com.run.pbf.Bcp.Email;
import com.run.pbf.Bcp.Ftp;
import com.run.pbf.Bcp.Game;
import com.run.pbf.Bcp.Hotel;
import com.run.pbf.Bcp.Http;
import com.run.pbf.Bcp.Https;
import com.run.pbf.Bcp.Im;
import com.run.pbf.Bcp.ImFriend;
import com.run.pbf.Bcp.ImGroupMember;
import com.run.pbf.Bcp.ImMedia;
import com.run.pbf.Bcp.ImMember;
import com.run.pbf.Bcp.Irc;
import com.run.pbf.Bcp.MediaChatRoom;
import com.run.pbf.Bcp.Other;
import com.run.pbf.Bcp.P2p;
import com.run.pbf.Bcp.Radius;
import com.run.pbf.Bcp.RemoteCtrl;
import com.run.pbf.Bcp.Search;
import com.run.pbf.Bcp.Shop;
import com.run.pbf.Bcp.SnsFriend;
import com.run.pbf.Bcp.SnsInfo;
import com.run.pbf.Bcp.SnsReg;
import com.run.pbf.Bcp.SpyData;
import com.run.pbf.Bcp.StreamMedia;
import com.run.pbf.Bcp.Telnet;
import com.run.pbf.Bcp.TerminalId;
import com.run.pbf.Bcp.Ticket;
import com.run.pbf.Bcp.NetTrack;
import com.run.pbf.Bcp.Voip;
import com.run.pbf.Bcp.Vpn;
import com.run.pbf.Bcp.Wap;
import com.run.pbf.Bcp.WebAccountInfo;
import com.run.pbf.Bcp.WebBBS;
import com.run.pbf.Bcp.WebChat;
import com.run.pbf.Bcp.WebMail;
import com.run.pbf.Bcp.WebMedia;
import com.run.pbf.Bcp.WebUser;


/**
 * Description: 协议类型的枚举
 * Copyright (c) Department of Research and Development/Beijing/Run.
 * All Rights Reserved.
 * @version 1.0  2012-6-4 下午05:35:50  by 张红意（hongyi@run.com）创建
 * modify by chenxu 2012-06-20
 */
public enum ProtocolType {
	
	
	HTTP(1) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP3;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Http.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Http";
		}
	},WEBCHAT(2) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return WebChat.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "WebChat";
		}
	},WEBBBS(3) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return WebBBS.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "WebBBS";
		}
	},WEBMAIL(4) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return WebMail.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "WebMail";
		}
	},EMAIL(5) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Email.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Email";
		}
	},IM(6) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Im.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Im";
		}
	},RADIUS(7) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Radius.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Radius";
		}
	},CMPP(8) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Cmpp.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Cmpp";
		}
	},FTP(9) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Ftp.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Ftp";
		}
	},TELNET(10) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Telnet.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Telnet";
		}
	},GAME(11) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Game.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Game";
		}
	},ANTIPROXY(12) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			
			try {
				return AntiProxy.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "AntiProxy";
		}
	},P2P(13) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return P2p.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "P2p";
		}
	},REMOTECTRL(14) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return RemoteCtrl.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "RemoteCtrl";
		}
	},IMMEDIA(15) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return ImMedia.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "ImMedia";
		}
	},VOIP(16) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Voip.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Voip";
		}
	},MEDIACHATROOM(17) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return MediaChatRoom.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "MediaChatRoom";
		}
	},STREAMMEDIA(18) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return StreamMedia.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "StreamMedia";
		}
	},HTTPS(19) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP3;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Https.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Https";
		}
	},WEBMEDIA(20) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return WebMedia.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "WebMedia";
		}
	},VPN(21) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Vpn.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Vpn";
		}
	},OTHER(22) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Other.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Other";
		}
	},A11(23) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return com.run.pbf.Bcp.A11.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "A11";
		}
	},WAP(24) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP3;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Wap.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Wap";
		}
	},WEBUSER(25) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return WebUser.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "WebUser";
		}
	},IRC(26) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Irc.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Irc";
		}
	},SNS(28) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			throw new RuntimeException("this protocol no support parse");
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return null;
		}
	},TERMINALID(29) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return TerminalId.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "TerminalId";
		}
	},TRAVELORDER(30) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			throw new RuntimeException("this protocol no support parse");
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return null;
		}
	},BLOG(31) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Blog.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Blog";
		}
	},SEARCH(32) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Search.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Search";
		}
	},SHOP(38) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Shop.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Shop";
		}
	},CISPONLINELOG(90) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return CispOnlineLog.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "CispOnlineLog";
		}
	},NETTRACK(91) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return NetTrack.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "NetTrack";
		}
	},DNS(70) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Dns.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Dns";
		}
	},IMFRIEND(71) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return ImFriend.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "ImFriend";
		}
	},IMGROUP(72) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return ImGroupMember.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "ImGroupMember";
		}
	},SPYDATA(73) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				SpyData.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "SpyData";
		}
	},HOTEL(74) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Hotel.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Hotel";
		}
	},TICKET(75) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return Ticket.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "Ticket";
		}
	},WEBACCOUNTINFO(76) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return WebAccountInfo.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "WebAccountInfo";
		}
	},SNSFRIEND(77) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return SnsFriend.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "SnsFriend";
		}
	},SNSINFO(78) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return SnsInfo.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "SnsInfo";
		}
	},SNSREG(79) {
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return SnsReg.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "SnsReg";
		}
	},IMMEMBER(80){
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return ImMember.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "ImMember";
		}
	},CRAWLERLOG(81){
		@Override
		public int getGroupNum() {return this.getGroupTyp().getNum();}
		@Override
		public GroupType getGroupTyp() {return GroupType.GROUP1;}
		@Override
		public GeneratedMessage parseFrom(byte[] data) {
			try {
				return CrawlerLog.parseFrom(data);
			} catch (InvalidProtocolBufferException e) {
				e.printStackTrace();
			}
			return null;
		}
		@Override
		public byte[] getBytes() {
			return new byte[]{(byte)this.getNum()};
		}
		@Override
		public String getName() {
			return "CrawlerLog";
		}
	};
	
	/**
	 * 根据数字获得相应的协议类型枚举
	 * @param num
	 * @return
	 */
	public static ProtocolType getProtocolTypeByNum(int num) {
		for(ProtocolType pt : ProtocolType.values()) {
			if(pt.getNum()==num) return pt;
		}
		throw new UnSupportProtocolTypeException("the num["+num+"] have not ProtocolType");
	}
	
	public static class UnSupportProtocolTypeException extends RuntimeException {

		/**
		 * 
		 */
		private static final long serialVersionUID = 6135398222303843906L;
		
		/**
	     * Constructs an UnsupportedEncodingException without a detail message.
	     */
	    public UnSupportProtocolTypeException() {
	        super();
	    }

	    /**
	     * Constructs an UnsupportedEncodingException with a detail message.
	     * @param s Describes the reason for the exception.
	     */
	    public UnSupportProtocolTypeException(String s) {
	        super(s);
	    }
		
	}
	
	private ProtocolType(int protocolTypeNum) {
		this.protocolTypeNum = protocolTypeNum;
	}
	
	private final int protocolTypeNum;

	public int getNum() {
		return this.protocolTypeNum;
	}
	
	public abstract int getGroupNum();
	public abstract GroupType getGroupTyp();
	public abstract GeneratedMessage parseFrom(byte[] data);
	public abstract byte[] getBytes();
	public abstract String getName();

}
